SMQ-2739 - Prevent removing of all users from Built in admin role#2835
Merged
dborovcanin merged 4 commits intoabsmach:mainfrom Jun 10, 2025
Merged
SMQ-2739 - Prevent removing of all users from Built in admin role#2835dborovcanin merged 4 commits intoabsmach:mainfrom
dborovcanin merged 4 commits intoabsmach:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
This is a feature
What does this do?
This PR introduces a safeguard that prevents all members from being removed from the built-in
adminrole on any domain. When an attempt is made to remove the last user from theadminrole, the system now rejects the request with:{ "error": "", "message": "failed to remove entity" }This ensures that at least one user always retains admin privileges, preventing domains from becoming orphaned.
Example behavior:
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Yes. Manual testing was performed by removing members via the
/domains/{domainID}/roles/{roleID}/members/deleteendpoint and verifying behavior with various admin user counts. Unit tests will follow up in a separate test refactor PR.Did you document any new/modified feature?
Yes. Documented at absmach/supermq-docs#223
Notes